<template>
  <div class="home">
    <div class="container">
      <div class="content-wrap">
        <div class="article-list">
          <div class="article-box" v-for="(item, index) in articleList" :key="index">
            <img :src="item.img" class="article-img" v-if="item.img" />
            <div class="right">
              <h3 class="title">{{ item.title }}</h3>
              <p class="desc">{{ item.desc }}</p>
              <ul class="title-msg">
                <li>
                  <i class="icon"></i>
                  <span>{{ item.category }}</span>
                </li>
                <li>
                  <i class="icon"></i>
                  <span>{{ item.date }}</span>
                </li>
                <li>
                  <i class="icon"></i>
                  <span>{{ item.hot }}℃</span>
                </li>
                <li>
                  <i class="icon"></i>
                  <span>{{ item.comment }}条</span>
                </li>
              </ul>
            </div>
          </div>
        </div>
        <Aside />
      </div>
    </div>
  </div>
</template>

<script lang="ts" setup>
import { reactive } from "vue";
import Aside from "@/layouts/aside/index.vue";

interface Article {
  id: number;
  img?: string;
  desc: string;
  title: string;
  category: string;
  date: string;
  hot: number;
  comment: number;
}

const articleList: Article[] = reactive([
  {
    id: 0,
    title: "Canvas快速画五角星",
    category: "前端",
    date: "2022-01-15",
    hot: 366,
    desc:
      "在Canvas中有直线和曲线两种基本图形。本文将讲述Canvas直线图形的绘制，并详细讲述直线、矩形、多边形这三种常见直线图形的绘制。",
    img:
      "http://m.360buyimg.com/mobilecms/s120x120_jfs/t1/125678/35/5947/4868/5efbf28cEbf04a25a/e2bcc411170524f0.png",
    comment: 20
  },
  {
    id: 0,
    title: "Canvas快速画五角星",
    category: "前端",
    date: "2022-01-15",
    hot: 366,
    desc:
      "在Canvas中有直线和曲线两种基本图形。本文将讲述Canvas直线图形的绘制，并详细讲述直线、矩形、多边形这三种常见直线图形的绘制。",
    img:
      "http://m.360buyimg.com/mobilecms/s120x120_jfs/t1/125678/35/5947/4868/5efbf28cEbf04a25a/e2bcc411170524f0.png",
    comment: 20
  },
  {
    id: 0,
    title: "Canvas快速画五角星",
    category: "前端",
    date: "2022-01-15",
    hot: 366,
    desc:
      "在Canvas中有直线和曲线两种基本图形。本文将讲述Canvas直线图形的绘制，并详细讲述直线、矩形、多边形这三种常见直线图形的绘制。",
    img:
      "http://m.360buyimg.com/mobilecms/s120x120_jfs/t1/125678/35/5947/4868/5efbf28cEbf04a25a/e2bcc411170524f0.png",
    comment: 20
  }
]);
</script>

<style scoped lang="scss">
.home {
  .container {
    width: 1140px;
    margin: 0 auto;
    .content-wrap {
      display: flex;
      padding-top: 30px;
      .article-list {
        flex: 1;
        padding-bottom: 50px;
        .article-box {
          padding: 20px;
          margin-bottom: 20px;
          background: #fff;
          border-radius: 6px;
          display: flex;
          .article-img {
            width: 150px;
            height: 150px;
            margin-right: 25px;
          }

          .right {
            flex: 1;
            .title {
              font-size: 18px;
              margin: 10px 0 30px;
            }
            .desc {
              color: #666;
              margin-bottom: 10px;
              font-size: 14px;
            }

            .title-msg {
              display: flex;
              align-items: center;
              padding-bottom: 10px;

              li {
                margin-right: 5px;
                .icon {
                }
                > span {
                  padding-left: 5px;
                  font-size: 12px;
                  color: #666;
                }
              }
            }
          }
        }
      }
    }
  }
}
</style>
